import localZhCN from './i18n/zh-cn.js'
import localEn from './i18n/en.js'
import 'virtual:svg-icons-register'
import {
    ResourceConn
} from './service/resource-conn.js'
import {
    ResouceCatalog
} from './service/resource-catalog.js'
import {
    ResouceTableType
} from './service/resource-table-type'
import {
    ResouceViewType
} from './service/resource-view-type'
import {
    ResouceTriggerType
} from './service/resource-trigger-type'
import {
	ResouceTable
} from './service/resource-table'
import {
	ResouceView
} from './service/resource-view'
import { SqlBuilder } from './service/SqlBuilder'

export default (opt) => {
    const i18n = opt.i18n
    console.log(opt)
    // 添加i18n 国际化信息
    i18n.add('zh-cn', localZhCN)
    i18n.add('en', localEn)
    return {
        // 左侧资源
        resource: {
            conn: {
                //连接图标
                icon: '#dbant-icon-sqlite-conn',
                //元数据配置
                metadataConfig: (params)=>new ResourceConn(opt, params).getMetadataConfig(),
                //连接右键返回数据
                contextMenu: function (params) {
                    return new ResourceConn(opt, params).getContextMenus();
                }
            },
            catalog: {
                //元数据配置
                metadataConfig: (params)=>new ResouceCatalog(opt, params).getMetadataConfig(),
                //连接图标
                //连接右键返回数据
                contextMenu: function (params) {
                    return new ResouceCatalog(opt, params).getContextMenus();
                }
            },
            table_type: {
                //元数据配置
                metadataConfig: (params)=>new ResouceTableType(opt, params).getMetadataConfig(),
                //连接图标
                //连接右键返回数据
                contextMenu: function (params) {
                    return new ResouceTableType(opt, params).getContextMenus();
                }
            },
            view_type: {
                //元数据配置
                metadataConfig: (params)=>new ResouceViewType(opt, params).getMetadataConfig(),
                //连接图标
                //连接右键返回数据
                contextMenu: function (params) {
                    return new ResouceViewType(opt, params).getContextMenus();
                }
            },
            trigger_type: {
                //元数据配置
                metadataConfig: (params)=>new ResouceTriggerType(opt, params).getMetadataConfig(),
                //连接图标
                //连接右键返回数据
                contextMenu: function (params) {
                    return new ResouceTriggerType(opt, params).getContextMenus();
                }
            },
            
            table: {
            		//数据展示配置
            		dataView: (params) => new ResouceTable(opt, params).getDataViewConfig(),
            		//元数据配置
            		metadataConfig: (params) => new ResouceTable(opt, params).getMetadataConfig(),
            		//连接图标
            		//连接右键返回数据
            		contextMenu: function (params) {
            			return new ResouceTable(opt, params).getContextMenus();
            		}
            	},
            	view: {
            		//数据展示配置
            		dataView: (params) => new ResouceView(opt, params).getDataViewConfig(),
            		//元数据配置
            		metadataConfig: (params) => new ResouceView(opt, params).getMetadataConfig(),
            		//连接图标
            		//连接右键返回数据
            		contextMenu: function (params) {
            			return new ResouceView(opt, params).getContextMenus();
            		}
            	}

        },
        sqlBuilder: new SqlBuilder(),
        //路由信息
        router: [{
            name: "testHome",
            path: "/test/testHome",
            meta: {
                name: "指定的首页"
            },
            // component: MagicTaskInfo
        }]
    }
}